home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F43186_testImproveMultiple.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-02-06  |  2.5 KB  |  71 lines

  1. <xsl:stylesheet version="1.0" 
  2. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xalan="http://xml.apache.org/xalan"
  4. xmlns:myImproveGenerator="myImproveGenerator"
  5. xmlns:myImproveController="myImproveController"
  6. >
  7.   <xsl:import href="improve.xsl"/>
  8.   <xsl:import href="take.xsl"/> 
  9.   <xsl:import href="takeWhile.xsl"/> 
  10.   
  11.   <myImproveGenerator:myImproveGenerator/>
  12.   <myImproveController:myImproveController/>
  13.  
  14.   <!-- To be applied on fiff-results.xml -->
  15.  
  16.   <xsl:output indent="yes" omit-xml-declaration="yes"/>
  17.  
  18.   <xsl:template match="/">
  19.      <xsl:variable name="vMyImproveGenerator" select="document('')/*/myImproveGenerator:*[1]"/>
  20.      <xsl:variable name="vMyImproveController" select="document('')/*/myImproveController:*[1]"/>
  21.  
  22.     <xsl:variable name="vrtfResults">
  23.         <xsl:call-template name="takeWhile">
  24.           <xsl:with-param name="pGenerator" select="$vMyImproveGenerator"/>
  25.           <xsl:with-param name="pParam0" select="/*/*"/>
  26.           <xsl:with-param name="pController" select="$vMyImproveController"/>
  27.           <xsl:with-param name="pContollerParam" select="0.00000000000001"/>
  28.         </xsl:call-template>
  29.     </xsl:variable>
  30.     
  31.     <xsl:copy-of select="xalan:nodeset($vrtfResults)/*"/>
  32.     
  33.   </xsl:template>
  34.   
  35.   <xsl:template name="myImproveGenerator" match="*[namespace-uri()='myImproveGenerator']">
  36.      <xsl:param name="pList" select="/.."/>
  37.      <xsl:param name="pParams" select="/.."/>
  38.      
  39.      <xsl:choose>
  40.        <xsl:when test="not($pList)">
  41.          <xsl:call-template name="improve">
  42.             <xsl:with-param name="pList" select="$pParams"/>
  43.          </xsl:call-template>
  44.        </xsl:when>
  45.        <xsl:otherwise>
  46.          <xsl:call-template name="improve">
  47.             <xsl:with-param name="pList" select="$pList[last()]/*"/>
  48.          </xsl:call-template>
  49.        </xsl:otherwise>
  50.      </xsl:choose>
  51.  
  52.   </xsl:template>
  53.   
  54.   <xsl:template name="MyImproveController" match="*[namespace-uri()='myImproveController']">
  55.     <xsl:param name="pList" select="/.."/>
  56.     <xsl:param name="pParams" select="0.01"/>
  57.     
  58.     <xsl:choose>
  59.       <xsl:when test="count($pList) < 2">1</xsl:when>
  60.       <xsl:otherwise>
  61.         <xsl:variable name="vDiff" select="$pList[last()]/*[2] 
  62.                                           - $pList[last() - 1]/*[2]"/>
  63.         <xsl:if test="not($vDiff < $pParams 
  64.                      and $vDiff > (0 - $pParams))
  65.                      and count($pList) <= 5
  66.                      ">1</xsl:if>
  67.       </xsl:otherwise>
  68.     </xsl:choose>
  69.   
  70.   </xsl:template>
  71. </xsl:stylesheet>